package zhang.lao.api.controller;/**
 * Created by zhangqin on 2017/11/23.
 */

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import zhang.lao.api.service.ApiReportService;
import zhang.lao.build.mybatis.jdbc.auto.model.WnFarm;
import zhang.lao.build.mybatis.jdbc.auto.model.WnMachineDevice;
import zhang.lao.build.mybatis.jdbc.auto.model.WnMachineDeviceExample;
import zhang.lao.build.redis.RedisUtil;
import zhang.lao.build.tool.date.DateStyle;
import zhang.lao.build.tool.date.DateUtil;
import zhang.lao.dao.base.WnFarmDao;
import zhang.lao.dao.base.WnMachineDeviceActiveGt06Dao;
import zhang.lao.dao.base.WnMachineDeviceDao;
import zhang.lao.extents.spring.handle.ApiData;
import zhang.lao.pojo.api.req.*;
import zhang.lao.pojo.api.resp.ApiRespData;
import zhang.lao.pojo.console.map.MapSerieResp;
import zhang.lao.pojo.console.report.AreaReportResp;
import zhang.lao.pojo.console.resp.HttpResultUtil;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author
 * @create 2017-11-23 17:52
 **/
@Controller
public class ApiReportController {
    @Autowired
    private ApiReportService apiReportService;
    @RequestMapping("/api/report/area")
    public @ResponseBody
    ApiRespData apiReportArea(@ApiData ApiReqData<ApiAreaReportReq> apiReqBodyApiReqData){
        return apiReportService.areaReport(apiReqBodyApiReqData);
    }
    @RequestMapping("/api/lnglat/{type}/{deviceId}")
    public @ResponseBody
    ApiRespData getNewLocation(@PathVariable int deviceId, @PathVariable int type){
        return apiReportService.getNewLocation(deviceId,type);
    }


    @RequestMapping("/api/report/active")
    public @ResponseBody
    ApiRespData apiReportActive(@ApiData ApiReqData<ApiActiveReportReq> apiReqBodyApiReqData){
        return apiReportService.activeReport(apiReqBodyApiReqData);
    }


    @RequestMapping("/api/report/resource")
    public @ResponseBody
    ApiRespData apiReportResource(@ApiData ApiReqData<ApiResourceReportReq> apiReqBodyApiReqData){
        return apiReportService.resourceReport(apiReqBodyApiReqData);
    }
    @RequestMapping("/api/device/work/report")
    public @ResponseBody
    ApiRespData deviceWorkReport(@ApiData ApiReqData<ApiDeviceWorkReportReq> apiReqBodyApiReqData){
        return apiReportService.deviceWorkReport(apiReqBodyApiReqData);
    }

}
